ramstream.htmlHTMLudogD¢πùΔ§πùΔ§ÅÅζ Monkeybread Realbasic plugin - Documentation - RAMStream

MBS Plugin Documentation

This is the documentation for the Realbasic Plugins from Monkeybreadsoftware.de. You find these plugins and the newest version of this document at http://www.monkeybreadsoftware.de/realbasic inside the plugins section.

This help was last updated on Freitag, 6. September 2002 and covers 2136 items: 126 classes, 2 controls and 583 global functions.

The list of the themes Global methods by category Global methods by name The list of the classes The list of the controls

class RAMStream

class, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Allows you to use a memory bases stream.
Notes:
If you need to concat lot's of streams, just make a RAMstream and write to it.

In the example folder is a project called "test ramstream speed" which tests the speed on concating 10000 strings which each 1000 bytes in length.

On my G4 Dual 1000 Mhz, I get this result:
String only: 22063 ticks
RAMStream: 18 ticks

Close

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Closes this object.
Notes: The destructor closes a RAMStream if you don't close it.

EOF as boolean

property, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns true if you are at the end of the stream.

Length as integer

property, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns the current length of the stream.
Notes: You can truncate the stream by setting this property.

LittleEndian as boolean

property, RAMStream Sa, 27. Jul 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Decides whether to convert integers read or wrote to the file.
Notes:
See Realbasics binarystream for more details.
For native platform you may set "littleendian=targetwin32".

MemoryUsed as integer

property, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: How much memory is currently used for this Stream.

Position as integer

property, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Returns current position.
Notes: You can set the current file stream position using this property.

Read(amount as Integer) as string

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads bytes into a string.
Example:
dim s as string
...
s=b.read(5)

ReadBlock(amount as Integer) as memoryblock

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads bytes into a memoryblock.
Example:
dim s as memoryblock
...
s=b.read(5)

Readbyte as integer

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads an 8bit Byte from the stream.
Example:
dim i as integer
...
i=B.readbyte

ReadLong as integer

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads a signed 32bit Integer from the stream.
Example:
dim i as integer
...
i=B.readlong
Notes: This function is affected by the LittleEndian Setting.

ReadPString as string

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads a pascal string from the file.
Example:
dim s as string
...
s=b.readpstring
Notes:
A Pascal String is a signle byte for the length of the string followed by the bytes which are the content of the string.
Dynamical length between 0 and 255 bytes which allways needs between 1 and 256 bytes to store on disk.

ReadShort as integer

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Reads a signed 16bit Integer from the stream.
Example:
dim i as integer
...
i=B.readshort
Notes: This function is affected by the LittleEndian Setting.

Write(data as string)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes bytes from a string to file.

WriteBlock(data as memoryblock,count as integeer)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes count bytes from a memoryblock to file.
Example:
dim m as memoryblock
...
b.writeblock m,size

WriteByte(data as integer)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes a byte to file.

WriteLong(data as integer)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes an 32bit integer to file.
Notes: This method is affected by the LittleEndian Setting.

WritePString(data as string)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes a Pascal String to disk.

WriteShort(data as integer)

method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Writes an 16bit integer to file.
Notes: This method is affected by the LittleEndian Setting.

CreateRamStream(guesssize as integer) as RAMStream

global method, RAMStream So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Works.
Function: Creates a new RAMStream.
Notes:
To avoid memory fragmentation the memory grows in 32K chunks.
But if you know the final size, just give it as a parameter. But still the stream can grow to around 2 GB.

Contact

Written 2002 by Christian Schmitz. Feel free to ask or report mistakes to realbasic@macsw.de.
Thanks.

This resource fork intentionally left blank ˇˇ